package com.libraryManage.controller;


import com.libraryManage.commons.utils.ResponseEntity;
import com.libraryManage.commons.utils.PageUtil;
import com.libraryManage.entity.LoginLogDo;
import com.libraryManage.entity.ManagerDo;
import com.libraryManage.service.ManagerService;
import com.libraryManage.vo.ManagerVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiResponse;
import io.swagger.annotations.ApiResponses;
import org.apache.shiro.authz.annotation.RequiresAuthentication;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @author yf
 * @since 2020-10-22
 */
@Api(tags={"系统管理接口"})
@RestController
@CrossOrigin
@RequestMapping("/manage/tool")
public class ManagerController {

    @Autowired
    ManagerService managerService;

//    @RequiresAuthentication//需要经过认证之后才能访问该接口
    @ApiOperation("获取登录日志")
    @ApiResponses({
            @ApiResponse(code=0, message="成功"),
            @ApiResponse(code=500, message="系统异常"),
            @ApiResponse(code=999, message="未登录"),
            @ApiResponse(code=1000, message="数据有效性检查不通过"),
            @ApiResponse(code=1001, message="业务规则检查不通过")
    })
    @RequestMapping(value = "/log" , method = RequestMethod.POST)
    public ResponseEntity<List<LoginLogDo>> getLogData(@RequestBody LoginLogDo loginLogDo){
        return managerService.getLogData(loginLogDo);
    }

}
